<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<script src="js/jquery-3.2.1.slim.min.js" type="text/javascript"></script> 
</head>
<!-- 播放音乐 loop="loop"-->
<audio id="notice" loop="loop">
	<source src="mp3/song.mp3" type="audio/mpeg">
</audio>
<script>
	var ordermsg="";
		var websocket=null;
		if('WebSocket' in window)
		{
			websocket=new WebSocket('ws://10.51.40.29:1993/task/webSocket/af9dfce6229027742860f3ae1ee08587');
		}else
		{
			alert("该浏览器不支持websocket!");
		}
		websocket.onopen=function(event)
		{
			console.log('连接建立');
			websocket.send("发送数据");
		}
		websocket.onclose=function(event)
		{
			console.log('连接关闭');
		}
		websocket.onmessage=function(event)
		{
			//sendMsg   操作状态、视频id、进度
			$("#receiveNsg").html(event.data);


			//if(msg[0]=="0")
		//	{
		//		$("#receiveNsg").html("资源【"+msg[1]+"】下载进度【"+msg[2]+"】");
		//	}else if(msg[0]=="1")
		//	{
		//		$("#receiveNsg").html("资源【"+msg[1]+"】解析进度【"+msg[2]+"】");
		//	}else if(msg[0]=="2")
		//	{
		//		$("#receiveNsg").html("资源【"+msg[1]+"】生成进度【"+msg[2]+"】");
		//	}
		//	$("#showmsg").html("坐标：111,"+msg[2]);
			//websocket=event.data;
		//	if(msg[0]=="1" && msg[2]=="100")
		//	{
				//弹窗播放音乐
		//		document.getElementById("receiveNsg").play();
		//	}
		//	console.log('收到消息：'+event.data);
			
		}
		websocket.onerror=function()
		{
			console.log('websocket通信发生错误！');
		}
		
		window.onbeforeunload=function()
		{
			websocket.close();
		}

	</script>

<body>
测试websocket!!

<div id="receiveNsg">V</div>
</body>
</html>